<!-- 上传所有文件 -->
<#macro file name value>
<input type="hidden" id="${name}" name="${name}" value="${value!''}" lay-verify="" class="layui-input">
<a id="${name}UploadImg" href="${value!''}">${value!''}</a>
<button type="button" class="layui-btn layui-btn-xs layui-btn-primary" id="${name}UploadBtn">
	<i class="layui-icon">&#xe67c;</i>上传文件
</button>
<script>
	layui.upload.render({
		accept : 'file',
		elem : '${r'#'}${name}UploadBtn',
		url : '/upload.json',
		done : function(res) {
			$("${r'#'}${name}").val(res.data.url);
			$("${r'#'}${name}UploadImg").attr("href", res.data.url);
			$("${r'#'}${name}UploadImg").text(res.data.url);
		}
	});
</script>
</#macro>

<!-- 上传图片 -->
<#macro image name value>
<input type="hidden" id="${name}" name="${name}" value="${value!''}" lay-verify="" class="layui-input">
<img id="${name}UploadImg" src="${value!''}"/>
<button type="button" class="layui-btn layui-btn-xs layui-btn-primary" id="${name}UploadBtn">
	<i class="layui-icon">&#xe67c;</i>上传图片
</button>
<script>
	layui.upload.render({
		accept : 'images',
		elem : '${r'#'}${name}UploadBtn',
		url : '/upload.json',
		done : function(res) {
			$("${r'#'}${name}").val(res.data.url);
			$("${r'#'}${name}UploadImg").attr("src", res.data.url);
		}
	});
</script>
</#macro>

<!-- 上传视频 -->
<#macro video name value>
<input type="hidden" id="${name}" name="${name}" value="${value!''}" lay-verify="" class="layui-input">
<a id="${name}UploadImg" href="${value!''}">${value!''}</a>
<button type="button" class="layui-btn layui-btn-xs layui-btn-primary" id="${name}UploadBtn">
	<i class="layui-icon">&#xe67c;</i>上传视频
</button>
<script>
	layui.upload.render({
		accept : 'video',
		elem : '${r'#'}${name}UploadBtn',
		url : '/upload.json',
		done : function(res) {
			$("${r'#'}${name}").val(res.data.url);
			$("${r'#'}${name}UploadImg").attr("href", res.data.url);
			$("${r'#'}${name}UploadImg").text(res.data.url);
		}
	});
</script>
</#macro>

<!-- 上传音频 -->
<#macro audio name value>
<input type="hidden" id="${name}" name="${name}" value="${value!''}" lay-verify="" class="layui-input">
<a id="${name}UploadImg" href="${value!''}">${value!''}</a>
<button type="button" class="layui-btn layui-btn-xs layui-btn-primary" id="${name}UploadBtn">
	<i class="layui-icon">&#xe67c;</i>上传音频
</button>
<script>
	layui.upload.render({
		accept : 'audio',
		elem : '${r'#'}${name}UploadBtn',
		url : '/upload.json',
		done : function(res) {
			$("${r'#'}${name}").val(res.data.url);
			$("${r'#'}${name}UploadImg").attr("href", res.data.url);
			$("${r'#'}${name}UploadImg").text(res.data.url);
		}
	});
</script>
</#macro>